#pragma once
#include <glm/glm.hpp>
#include <memory>

namespace Umikaze::Core {
enum Camera_Movement { FORWARD, BACKWARD, LEFT, RIGHT, UP, DOWN };
class Camera {
public:
  void useOrthoCamera();

  void usePerspectiveCamera();

  glm::mat4 getViewMatrix() const;

  glm::mat4 getProjMatrix() const;

  glm::vec3 getPosition() const;

  bool useOrtho = false;

  float _near = 0.5f, _far = 100.0f, _fov = 45.0f, _aspect;
  float _leftPlane = -100.0f, _rightPlane = 100.0f, _topPlane = 100.0f,
        _bottomPlane = 100.0f;

  float _yaw = -90.0f, _pitch = 0.0f;

  glm::vec3 _position = glm::vec3(0.0f, 0.0f, 5.0f);
  glm::vec3 _forward = glm::vec3(0.0f, 0.0f, -1.0f);
  glm::vec3 _up = glm::vec3(0.0f, 1.0f, 0.0f);
  glm::vec3 _target;
  glm::vec3 _right;

  void ProcessKeyboard(Camera_Movement direction, float deltaTime);

  void ProcessMouseMovement(float xoffset, float yoffset,
                            bool constrainPitch = true);

  void ProcessMouseScroll(float yoffset);

private:
  void updateCameraVectors();
};

extern std::shared_ptr<Camera> gDefaultCamera;

} // namespace Umikaze::Core
